/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.templates.RobotMap;

/**
 *
 * @author Robotics
 */
public class Pneumatic extends Subsystem {
     private Compressor Compressor;
     private Relay Piston;
     private boolean pistonState;
                  
    public Pneumatic () {
        Compressor = new Compressor(RobotMap.PRESSURE_SWITCH_DIO, RobotMap.COMPRESSOR_SPIKE_RELAY);
        Piston = new Relay(RobotMap.PISTON_SPIKE_RELAY, Relay.Direction.kBoth);
        pistonState = false;
        Compressor.start();
    }
    
    public boolean getPistonState(){
        return pistonState;
    }
    
    public void setPistonState(boolean pS){
        pistonState = pS;
    }

    public void extendPiston(){
        Piston.set(Relay.Value.kForward);
        pistonState = true;
        SmartDashboard.putBoolean("Piston State: ", pistonState);
    }

    public void retractPiston(){
        Piston.set(Relay.Value.kReverse);
        pistonState = false;
        SmartDashboard.putBoolean("Piston State: ", pistonState);
    }
    
    public void initDefaultCommand() {
    
    }
}